//
//  AudioRateManager.swift
//  GhostWorld
//
//  Created by Kam on 2018/6/29.
//  Copyright © 2018 LKGood. All rights reserved.
//

import Foundation

class AudioRateManager {
  
  // MARK: - Singleton
  static let shared = AudioRateManager()
  private init() { }
  
  func loadRate(audio: Audio, completion: @escaping (Int) -> Void) {
    API.shared.requestAPI (
      APIURLStrings.getAudioRate(audioID: Int(audio.id)),
      method: .get,
      successCallback: { json in
        completion(json["rate"].intValue)
    }) { (message, code) in
      loggingPrint("\(message), \(code)")
    }
  }
}
